#region Using Statements

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

#endregion

namespace Xfinity.Engine.Plugins
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public partial class GamepadEvents : GameComponent
    {
        public GamepadEvents(Game game)
            : base(game)
        {
            // TODO: Construct any child components here
        }


        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            base.Initialize();
        }

        public event GamePadKeyEventHandler OnGamePadInput;

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            GamePadState state = GamePad.GetState(PlayerIndex.One);
            OnGamePadInput(new GamePadEventArgs(state));

            base.Update(gameTime);
        }

    }
    public delegate void GamePadKeyEventHandler(GamePadEventArgs e);

    public class GamePadEventArgs : EventArgs
    {
        GamePadState state;

        public GamePadState State
        {
            get { return state; }
        }

        public GamePadEventArgs(GamePadState state)
            : base()
        {
            this.state = state;
        }
    }
}


